#import "UIImageView+YLHighlightedWebCache.h"

#if YL_UIKIT

#import "UIView+YLWebCacheOperation.h"
#import "UIView+YLWebCache.h"

@implementation UIImageView (YLHighlightedWebCache)

- (void)yl_setHighlightedImageWithURL:(nullable NSURL *)url {
    [self yl_setHighlightedImageWithURL:url options:0 progress:nil completed:nil];
}

- (void)yl_setHighlightedImageWithURL:(nullable NSURL *)url options:(YLWebImageOptions)options {
    [self yl_setHighlightedImageWithURL:url options:options progress:nil completed:nil];
}

- (void)yl_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable YLExternalCompletionBlock)completedBlock {
    [self yl_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock];
}

- (void)yl_setHighlightedImageWithURL:(nullable NSURL *)url options:(YLWebImageOptions)options completed:(nullable YLExternalCompletionBlock)completedBlock {
    [self yl_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock];
}

- (void)yl_setHighlightedImageWithURL:(nullable NSURL *)url
                              options:(YLWebImageOptions)options
                             progress:(nullable YLWebImageDownloaderProgressBlock)progressBlock
                            completed:(nullable YLExternalCompletionBlock)completedBlock {
    __weak typeof(self)weakSelf = self;
    [self yl_internalSetImageWithURL:url
                    placeholderImage:nil
                             options:options
                        operationKey:@"UIImageViewImageOperationHighlighted"
                       setImageBlock:^(UIImage *image, NSData *imageData) {
                           weakSelf.highlightedImage = image;
                       }
                            progress:progressBlock
                           completed:completedBlock];
}

@end

#endif
